Release 10.1A: OpenEdge Data Management:
SQL Development


Working with views

A view is a virtual table created by a query. The query can retrieve data from specific columns in one or more tables. Views are created when users need to routinely query one or more tables for the same information.

CREATE VIEW

Use the CREATE VIEW statement to create a view on existing tables or views. You specify the name for the VIEW.

Example 5–8 demonstrates the use of a code sample. The statement is used to retrieve information from the customer base, but only information on those customers located within the six New England states.

Example 5–8: CREATE VIEW statement
 CREATE VIEW ne_customer AS 
     SELECT cust_no, last_name, street, city, state 
     FROM SPORTS.customer 
     WHERE state in ('NH', 'MA', 'ME', 'CT', 'RI', 'VT') ; 

DROP VIEW

The statement needed to drop a view is a short and simple one, as shown in Example 5–9.

Example 5–9: DROP VIEW statement
DROP VIEW ne_customer; 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095